import { $post, $put } from '@js/authRequest'

// 新建配置项
export async function addConfigRequest (data) {
  const res = await $post('/api/common/dictionary', data)
  if (res.status !== 1) {
    throw new Error(res.message)
  }
  return res.data
}

// 更新配置项
export async function updateConfigRequest (data) {
  const id = data.id
  delete data.id
  const res = await $put(`/api/common/dictionary/${id}`, data)
  if (res.status !== 1) {
    throw new Error(res.message)
  }
  return res.data
}
